package vn.sunnet.backviet01.game.coloa.util.mypool;


import org.anddev.andengine.entity.sprite.Sprite;
import org.anddev.andengine.opengl.texture.region.TextureRegion;

import vn.sunnet.backviet01.game.coloa.AuLac.Arrow;

public class NewArrowPool extends MyGenericPoolSprite<Arrow>{
	TextureRegion mTextureRegion;
	
	public NewArrowPool(TextureRegion pTextureRegion) {
		super();
		mTextureRegion = pTextureRegion;
	}

	@Override
	public Arrow newObject() {
		return new Arrow(0, 0, mTextureRegion);
	}

	@Override
	public void onRecycleObject(Arrow object) {
		object.setIgnoreUpdate(true);
		object.clearEntityModifiers();
		object.clearUpdateHandlers();
		object.detachChildren();
		object.detachSelf();
		object.resetInforArrow();
		object.reset();
	}

	public void resetTextureRegion(TextureRegion pTextureRegion) {
		mTextureRegion = pTextureRegion;
		Sprite temp;
		
		for (int i = 0; i < mAvailableRecycle; i++) {
			temp = freeObjects.get(i);
			temp.updateTextureRegion(mTextureRegion, true);
		}
	}
	
	@Override
	public void onClearPool() {
		
	}

}
